﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
using System.Data;

public partial class adminstrator_addStudent : System.Web.UI.Page
{
    public OleDbConnection myConnection;
    public static readonly string sConnectionString = System.Configuration.ConfigurationManager.AppSettings["SQLConnString"].ToString();


    protected void Page_Load(object sender, EventArgs e)
    {
        myConnection = new OleDbConnection(sConnectionString);
        myConnection.Open();
        if (Session["UserName"] == null && Session["UserNo"] == null)//没有经过正常途径打开页面
            Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='TextAlign/javascript'>" +
              "alert('登录超时（或未登录）,请你重新登录');parent.location.href='../login.aspx'</script>", false);
       
    }

    protected void ButtonOK_Click(object sender, EventArgs e)
    {
        string stuNo = UserNo.Text.Trim();
        string stuName = UserName.Text.Trim();
     string stuScore=stuScore.Text.Trim();
        
            mycmd = new OleDbCommand(myinsert, myConnection);
            mycmd.ExecuteScalar();
            Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('学生成绩添加成功！');</script>", false);
            UserNo.Text = "";
            UserName.Text = "";
           
            LabelError.Text = "";
        }
    }
    protected void ButtonReset_Click(object sender, EventArgs e)
    {
        UserNo.Text = "";
        UserName.Text = "";
       
      
        LabelError.Text = "";
    }
}